package com.boom.monitor.controller;

import com.boom.monitor.DTO.SnmpDTO;
import com.boom.monitor.DTO.VmwareDTO;
import com.boom.monitor.VO.jmx.Overview;
import com.boom.monitor.VO.snmp.SnmpOverview;
import com.boom.monitor.VO.vmware.BoomHostSystem;
import com.boom.monitor.service.BoomJmxService;
import com.boom.monitor.service.BoomSnmpService;
import com.boom.monitor.service.BoomVmwareService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.io.IOException;

/**
 * @author:yzw
 * @Date:2021/3/19 下午2:13
 * @desc:
 * @version:1.0
 */
@RestController
@RequestMapping("/boomMonitor")
public class MonitorController {

	/**
	 * 获取vmware
	 *
	 * @param dto
	 * @return com.boom.monitor.VO.vmware.BoomHostSystem
	 * @author yzw
	 * @time 2021/4/1 下午1:57
	 */
	@GetMapping("/vmware/list")
	@PreAuthorize("@ss.hasPermi('boomMonitor:vmware:list')")
	public BoomHostSystem getVmwareList(VmwareDTO dto) {
		return BoomVmwareService.getVmware(dto);
	}

	/**
	 * 获取jmx信息
	 *
	 * @param ip
	 * @param port
	 * @return com.boom.monitor.VO.jmx.Overview
	 * @author yzw
	 * @time 2021/4/1 下午1:58
	 */
	@GetMapping("/jmx/list")
	@PreAuthorize("@ss.hasPermi('boomMonitor:jmx:list')")
	public Overview getJmxList(String ip, Integer port) throws IOException {
		return BoomJmxService.overview(ip, port);
	}

	/**
	 * 获取SNMP信息
	 * @param dto
	 * @return void
	 * @author yzw
	 * @time 2021/4/6 下午2:07
	 */
	@GetMapping("/snmp/list")
	@PreAuthorize("@ss.hasPermi('boomMonitor:snmp:list')")
	public SnmpOverview getSnmpList(SnmpDTO dto) {
		return BoomSnmpService.getOverView(dto);
	}
}
